/*
 * serverIntArrayMV.cc
 *
 *  Created on: Jun 30, 2011
 *      Author: peckb1
 */

#include "serverIntArrayMV.h"

ServerIntArrayMV::ServerIntArrayMV(char* name, int valueArraySize, int machineId) {
    _valueArray = new int[valueArraySize];
    _name = new char[strlen(name)];
    strcpy(_name, name);
    _machineId = machineId;
    _size = valueArraySize;
    _timesCreated = 1;
}

ServerIntArrayMV::~ServerIntArrayMV() {
    delete _valueArray;
    delete _name;
}

int
ServerIntArrayMV::GetSize() {
    return _size;
}

char*
ServerIntArrayMV::GetName() {
    return _name;
}

int
ServerIntArrayMV::GetMachineId() {
    return _machineId;
}

int
ServerIntArrayMV::GetValue(int index) {
    return _valueArray[index];
}

void
ServerIntArrayMV::SetValue(int index, int newValue) {
    _valueArray[index] = newValue;
}

void
ServerIntArrayMV::addUser() {
    _timesCreated ++;
}

void
ServerIntArrayMV::removeUser() {
    _timesCreated --;
}

int
ServerIntArrayMV::getActiveUsers() {
    return _timesCreated;
}
